package com.easytake.emotioncat.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Tag(name = "swagger接口测试")
@RestController
@RequestMapping("/swagger")
public class SwaggerController {

    @Operation(summary = "请求列表")
    @GetMapping("/list")
    public List<SwaggerModel> list(@RequestBody SwaggerQueryParam param) {
        return new ArrayList<>(Arrays.asList(new SwaggerModel()));
    }


    @Schema(name = "实体")
    @Data
    class SwaggerModel {
        @Schema(description = "唯一标识", defaultValue = "自增整数")
        private int id;

        @Schema(description = "名称", example = "张三", type = "字符串")
        private String name;
    }

    @Schema(name = "请求参数")
    @Data
    class SwaggerQueryParam {
        private int id;
    }


}
